import { defineStore } from "pinia"
import { computed, reactive } from "vue"
import { getCarList } from "@/serve/_";
import { CarType } from "@/types/res/car";

export const useCarStore = defineStore('car', () => {
  const state: {
    carList: CarType[]
  } = reactive({
    carList: []
  })

  const carArr = computed(() => {
    return state.carList
  })

  let PostCarList = async () => {
    state.carList = await getCarList()
  }


  return { carArr, PostCarList }
})